<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('编辑帖子')"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-edit" th:object="${talk}">
        <input id="talkId" name="talkId" th:field="*{talkId}" type="hidden"/>
        <input id="userId" name="userId" th:field="*{userId}" type="hidden"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">主题：</label>
            <div class="col-sm-8">
                <input class="form-control" id="talkCenter" name="talkCenter" required th:field="*{talkCenter}"
                       type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">内容：</label>
            <div class="col-sm-8">
					<textarea class="form-control" id="talkContent" name="talkContent" required
                              style="margin: 0px 12px 0px 0px; width: 461px; height: 344px;"
                              th:field="*{talkContent}" type="text"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    $(function () {

    });

    function edit() {
        var talkId = $("input[name='talkId']").val();
        var userId = $("input[name='userId']").val();
        var talkCenter = $("input[name='talkCenter']").val();
        var talkContent = $("textarea[name='talkContent']").val();
        $.ajax({
            cache: true,
            type: "POST",
            url: ctx + "sau/mytalk/updateMyTalk",
            data: {
                "talkId": talkId,
                "userId": userId,
                "talkCenter": talkCenter,
                "talkContent": talkContent
            },
            async: false,
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.operate.successCallback(data);
            }
        });
    }

    function submitHandler() {
        if ($.validate.form()) {
            edit();
        }
    }
</script>
</body>
</html>
